public class Cone implements Area, Volume, Comparable<Cone>
{
    private Circle Underside;
    private double height;

    Cone()
    {
        this(new Circle(),0);
    }

    public Cone(Circle di,double gao)
    {
        this.Underside=new Circle(di);
        this.height=gao;
    }

    Cone(Cone c)
    {
        this.Underside=new Circle(c.Underside);
        this.height=c.height;
    }


    public double area()
    {
        return Underside.area()+Underside.perimeter()*getL()/2;
    }

    public double volume()
    {
        return Underside.area()*height/3;
    }

    public double getL()//获取母线长度
    {
        double r=Underside.getR();
        return Math.sqrt(r*r+height*height);
    }

    public Circle getUnderside()
    {
        return Underside;
    }

    public double getHeight()
    {
        return height;
    }

    public int compareTo(Cone o)
    {
        double a1=volume();
        double a2=o.volume();
        return a1<a2?-1:a1>a2?1:0;
    }

}
